home *** CD-ROM | disk | FTP | other *** search
/ Belgian Amiga Club - ADF Collection / BS1 part 05.zip / BS1 part 5 / PDraw3.0.adf / pdraw_rex.lzh / StyleTagDelete.pdrx < prev    next >
Text File  |  1992-06-15  |  1KB  |  74 lines

  1. /*
  2. @N
  3.  
  4. This Genie will delete a previously defined style
  5. */
  6. cr = '0a'x
  7. styledb    = "S:PDStyles.db"
  8.  
  9.  
  10. if ~open(file, styledb, "r") then
  11.     exit_msg("No styles have been defined. Used AddStyleTag Genie to create a style tag.")
  12.  
  13. lines = ''
  14. counter = 0
  15.  
  16. call pdm_ShowStatus("Reading style database..")
  17.  
  18. do while ~eof(file)
  19.  
  20.     line = strip(readln(file))
  21.  
  22.     if line = '' then iterate
  23.  
  24.     parse var line stylename '@' .
  25.  
  26.     lines = lines || cr || stylename
  27.  
  28.     counter = counter + 1
  29.     linevals.counter.0 = stylename
  30.     linevals.counter.1 = line
  31.  
  32. end
  33.  
  34. call close(file)
  35.  
  36. if counter = 0 then 
  37.     exit_msg("No styles have been defined. Used AddStyleTag Genie to create a style tag.")
  38.  
  39.  
  40. lines = substr(lines,2)
  41.  
  42. nlines = min(max(counter, 5), 10)
  43.  
  44. stylename = pdm_SelectFromList("Select style to delete..", 30, nlines, 0, lines)
  45. if stylename = '' then exit_msg()
  46.  
  47. output = ''
  48.  
  49. do i = 1 to counter
  50.  
  51.     if linevals.i.0 ~= stylename then output = output || cr || linevals.i.1
  52.  
  53. end
  54.  
  55. if ~open(file, styledb, "w") then
  56.     exit_msg("Unable to upon the Style data base for writing!!")
  57.  
  58. output = substr(output, 2)
  59. call writeln(file, output)
  60. call close(file)
  61.  
  62. exit_msg()
  63.  
  64. exit_msg: procedure
  65. do
  66.     parse arg message
  67.  
  68.     if message ~= '' then call pdm_inform(1,message,)
  69.     call pdm_SetBatchMode(0)
  70.     call pdm_ClearStatus()
  71.     call pdm_AutoUpdate(1)
  72.     exit
  73. end
  74.